<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>05_JS运算符</title>
</head>
<body>
<script>
    //1.算数运算符
    let a = 10;
    let b = 20;
    console.log(6/2); //3
    console.log(3/2); //1.5
    //如果比较运算符任意一边有数字，会现将非数字的值转为数字在进行比较
    console.log(3>10);// false
    console.log('3'>10);// false
    console.log(3>'10');// true
    //字符之间比较的是编码值
    console.log('3'>'10');// false
    //'1000003'.charCodeAt(6)查看指定下标出字符的编码值
    //如果不写方法参数看的是第一个字符的编码值
    //二进制 1 0
    console.log('超'.charCodeAt());
    console.log('宇'.charCodeAt());
    console.log('超'>'宇');// true
    console.log('3'.charCodeAt());//51
    console.log('1000003'.charCodeAt(6));//51

    let a = 1;
    let b = true;
    console.log(a == b); //true,松散比较运算符，只比较值1与Number（true）的值相等
    console.log(a === b);//false,严格比较运算符，先比较数据类型，类型一样在比较值number≠boolean

    let c = 0;
    console.log(c == 0? 'YES':'NO');// YES
    // = 为赋值符号，先将c的值赋值为0，然后转为布尔的到false，对于三目运算符来说，false取值'NO'
    console.log(c = 0? 'YES':'NO');// NO
</script>
</body>
</html>